// @ts-ignore
/* eslint-disable */
import { OpenApi as request } from "@/utils/request";

/** 绑定微信手机号 POST /mall/auth/bindPhone */
export async function bindPhone(
  body: API.WeChatBindPhoneDto,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseAuthToken>(
    `/barter-user/mall/auth/bindPhone`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 小程序登录 POST /mall/auth/mnpLogin */
export async function mpLogin(
  body: API.WeChatLoginCodeDto,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseAuthToken>(`/barter-user/mall/auth/mnpLogin`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 密码登录（测试使用） POST /mall/auth/password */
export async function passwordLogin(
  body: API.LoginValidateDto,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseAuthToken>(`/barter-user/mall/auth/password`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取登录用户信息 GET /mall/auth/userInfo */
export async function getUserInfo(options?: { [key: string]: any }) {
  return request<API.BaseResponseMallUserInfoVo>(
    `/barter-user/mall/auth/userInfo`,
    {
      method: "GET",
      ...(options || {}),
    }
  );
}
